#include <REGX52.H>
#include "Delay.h"

sbit SER=P3^4;  //SER  
sbit RCK=P3^5; //RCLK 
sbit SCK=P3^6;  //SRCLK  移位

/**
  * @brief  输入点阵屏的某列的数据
  * @param  输入的数据
  * @retval 
  */

void _74HC595_WriteByte(unsigned char Byte)
{
	unsigned char i;
	for(i=0;i<8;i++)
	{
			SER=Byte&(0x80>>i);
		SCK=1;
		SCK=0;
	}
	RCK=1;
		RCK=0;
}

/**
  * @brief  选择点阵屏的列并输入数据
  * @param  选择列,范围0~7;
  * @param  输入的数据
  * @retval 
  */

void  MatrixLED_ShowColumn(unsigned char Column,Data)
{
	
  _74HC595_WriteByte(Data);
	P0=~(0x80>>Column);
	Delay(1);
	P0=0xFF;
}



unsigned char code Animation[]={0x00,0x0E,0x1B,0x7F,0x7F,0x1B,0x0E,0x00,
								0x00,0x04,0x0C,0x18,0x7F,0x7F,0x1B,0x0E,
								0x00,0x08,0x0C,0x05,0x7F,0x7F,0x1E,0x0C,
								0xC0,0x00,0x41,0x22,0x1A,0x7C,0x7D,0x1A,
								0x00,0x60,0x61,0x12,0x0A,0x7E,0x7F,0x08,
								0x00,0x06,0x0E,0x08,0x0B,0x3E,0x3E,0x0B,
								0x00,0x03,0x0B,0x08,0x0B,0x3E,0x3E,0x0B,
								0x00,0x06,0x0E,0x08,0x09,0x3F,0x3E,0x0B,
								0x00,0x0E,0x13,0x7E,0x7E,0x1F,0x0E,0x00,
								0x08,0x13,0x7E,0x7E,0x12,0x1D,0x0C,0x00,
								0x09,0x12,0x7E,0x7F,0x10,0x13,0x03,0x00,
								0x09,0x12,0x7E,0x7F,0x10,0x1C,0x0C,0x00,
								0x00,0x0C,0x15,0x7E,0x7E,0x17,0x0E,0x00,
								0x00,0x30,0x38,0x0D,0x7E,0x7F,0x1D,0x08,
								0xC0,0xC0,0x30,0x1B,0x7C,0x7F,0x08,0x00,
								0x00,0x00,0x37,0xF8,0xFA,0x34,0x00,0x00,
								0x00,0x00,0x1B,0x7C,0x7C,0x1A,0x01,0x00,
								0x00,0x00,0x09,0x1E,0x7C,0x7F,0x18,0x00,
								0x00,0x00,0x1B,0x7C,0x7C,0x1B,0x00,0x00,
								0x00,0x00,0x09,0x1E,0x7C,0x7F,0x18,0x00,
								0x00,0x00,0x1B,0x7C,0x7C,0x1B,0x00,0x00,
								0x08,0x10,0x16,0x7C,0x7F,0x10,0x08,0x00,
								0x00,0x10,0x13,0x7C,0x7E,0x18,0x00,0x00,
								0x00,0x08,0x13,0x7C,0x7F,0x10,0x10,0x00,
								0x00,0x08,0x12,0xFC,0xFD,0x3A,0x00,0x00,
								0x00,0x08,0x12,0xFC,0xFC,0x22,0x10,0x00,
								0x00,0x00,0x61,0x12,0x7C,0x7F,0x10,0x60,
								0x00,0x00,0x20,0x11,0x12,0x7C,0x7E,0x19,
								0x00,0x00,0x00,0x31,0x0A,0x7C,0x7E,0x0D,
								0x00,0x00,0x20,0x11,0x12,0x7C,0x7E,0x19,
								0x00,0x00,0x00,0x31,0x0A,0x7C,0x7E,0x0D,
								0x00,0x00,0x20,0x11,0x12,0x7C,0x7E,0x19,
								0x00,0x00,0x00,0x31,0x0A,0x7C,0x7E,0x0D,
								0x00,0x00,0x20,0x11,0x12,0x7C,0x7E,0x19,
								0x00,0x00,0x00,0x31,0x0A,0x7C,0x7E,0x0D};


  void main()
{
	unsigned char a,b=0,c=0;
	RCK=0;
	SCK=0;
	
	while(1)
	{
		for(a=0;a<8;a++)
		{
			MatrixLED_ShowColumn(a,Animation[a+b]);
		}
		 c++;
	if(c>25)
	{
		c=0;
		b+=8;   //递进8列,即全屏更换
		if(b>10000 )//延长播放时间
	{
		b=0;
	}
	}

	}
}
